﻿// 功能：标题栏面板
// 描述：
// 作者：温伟鹏
// 日期：2010/5/27 21:49:47

using System;
using System.Runtime.InteropServices;
using System.Drawing;
using MeizuSDK.Drawing;

namespace MeizuSDK.Presentation
{
    /// <summary>
    /// 标题栏面板
    /// </summary>
    public class CaptionPanel : Control
    {
        #region DllImport

        [DllImport("MZFCWrapper.dll")]
        private static extern IntPtr UiCaptionWrapperCtor(PaintWinFunc onPaintWin);
        [DllImport("MZFCWrapper.dll")]
        private static extern void UiCaptionWrapperDefaultPaintWin(IntPtr pObj, IntPtr hdcDst, ref RECT prcWin, ref RECT prcUpdate);
        #endregion

        #region 构造函数
        /// <summary>
        /// 构造标题面板控件
        /// </summary>
        public CaptionPanel()
        {
            Handle = UiCaptionWrapperCtor(PaintWinDelegate);
            SetID();
            Size = new System.Drawing.Size(Screen.Width, 100);
        }
        #endregion

        #region 函数
        /// <summary>
        /// 由系统绘制此控件
        /// </summary>
        /// <param name="hdcDst">设备上下文</param>
        /// <param name="prcWin">控件所在区域</param>
        /// <param name="prcUpdate">更新区域</param>
        protected override void OnDefaultPaintWin(IntPtr hdcDst, ref RECT prcWin, ref RECT prcUpdate)
        {
            UiCaptionWrapperDefaultPaintWin(Handle, hdcDst, ref prcWin, ref prcUpdate);
        }
        #endregion
    }
}
